<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="timer">答题开始</div>
<script>
    var timerDiv = document.getElementById("timer");
    var countdown = 50;
    function updateTime() {
        if (countdown <= 0) {
            timerDiv.innerHTML= "本题结束";
        } else {
            countdown--;
            timerDiv.innerHTML= "你还有 " + countdown + " 秒时间完成此题";
            setTimeout(function () {
                updateTime()
            }, 1000)
        }
    }
    setTimeout(function () {
        updateTime()
    }, 1000)
</script>
</body>
</html>